﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;

namespace mitasoft.Web.Core
{
    public static class UrlHelperExtensions
    {
        public static string IsMached(this UrlHelper helper, string action, string controller,
            string matchClass, string notMatch)
        {

            bool isMatched =
                action.Equals(HttpContext.Current.Request.RequestContext.RouteData.Values ["action"]) &&
                controller.Equals(HttpContext.Current.Request.RequestContext.RouteData.Values ["controller"]);

            return isMatched ? matchClass : notMatch;
        }


        public static string MediaUrl(string rightPath)
        {
            return string.Format("http://{0}/Media/{1}", HttpContext.Current.Request.Url.Authority, rightPath);
        }
    }
}